package com.hanhy;




import java.util.*;

/**
 * Created by Administrator on 2016/12/12.
 */
public class HelloWorld {
    public static void findValue(){
        Map map = new TreeMap<String,String>();
        map.put("host","小写host 10.4.0.107");
        map.put("cookie","小写cookie username");
        map.put("Host","大写Host192.168.12.5");
        map.put("Cookie","大写Cookie houhou");

        System.out.println("利用KeySet");
        for (Object key:map.keySet()) {
            System.out.println(map.get(key));
        }
        System.out.println("利用entrySet");
        Set<Map.Entry<String,String>> mapEntry = map.entrySet();
        Iterator iterator = mapEntry.iterator();
        while(iterator.hasNext()){
            Map.Entry<String,String> entry = (Map.Entry<String, String>) iterator.next();

            System.out.println(entry.getValue());
        }
        List<String> list = new ArrayList<String>();
        if (list.isEmpty()){
            list.add("a");
            list.add("world");
            list.add("hello");
            list.add("world");
        }

        System.out.println("List");
        Iterator i = list.iterator();
        while(i.hasNext()){
            System.out.println(i.next());
        }
    }

    public static void main(String[] args) {
        findValue();
    }
}
